import FlyPropellerCtrl from "./FlyPropellerCtrl";
import MatchGameUtilsDataMgr from "./MatchGameUtilsDataMgr";
import flyPropellerPrefab from "./flyPropellerPrefab";
import PropAniCtrl from "./PropAniCtrl";

const { ccclass, property } = cc._decorator;

@ccclass
export default class FlyPropellerPrefabCtrl extends cc.Component {
    ui = null;

    onLoad() {
        this.onUILoad();
        this.addButtonListen();
    }

    start() { }

    onUILoad() {
        this.ui = this.node.addComponent(flyPropellerPrefab);
    }

    addButtonListen() { }

    initData() { }

    init(e, t) {
        this.node.active = true;
        var a = MatchGameUtilsDataMgr.getPos(e.i, e.j);
        this.node.x = a.x;
        this.node.y = a.y;
        PropAniCtrl.playFlyPropllerAni({
            row: e.i,
            col: e.j
        }, this.ui.spine.getComponent(sp.Skeleton), t);
    }

    destorySelf1() {
        FlyPropellerCtrl.destoryFlyItem(this.node);
    }
}
